package com.xjc.controller.request;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 完成任务参数
 * </p>
 *
 * @author xiaojincai
 * @since 2025-07-10
 */
@Data
@Schema(description = "CompleteTaskDTO")
public class CompleteTaskDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 任务id
     */
    @NotBlank(message = "任务id不能为空")
    @Schema(description = "任务id")
    private String taskId;

    /**
     * 用户
     */
    @NotBlank(message = "用户不能为空")
    @Schema(description = "用户")
    private String user;

    /**
     * 加签类型 1-前加签 2-后加签 默认2
     */
    @Min(value = 1, message = "加签类型 1-前加签 2-后加签")
    @Max(value = 2, message = "加签类型 1-前加签 2-后加签")
    @Schema(description = "加签类型 1-前加签 2-后加签 默认2")
    private Integer signType;

    /**
     * 加签用户
     */
    @Schema(description = "加签用户")
    private List<String> signUsers;

    /**
     * 并行用户
     */
    @Schema(description = "并行用户")
    private List<String> parallelUsers;

    /**
     * 委派用户
     */
    @Schema(description = "委派用户")
    private String delegateUser;

    /**
     * 转办用户
     */
    @Schema(description = "转办用户")
    private String transferUser;

    /**
     * 审批意见
     */
    @Schema(description = "审批意见")
    private String comment;

    /**
     * 流程变量
     */
    @Schema(description = "流程变量")
    private Map<String, Object> variables;

    /**
     * 节点流程变量
     */
    @Schema(description = "节点流程变量")
    private Map<String, Object> localVariables;

    public Integer getSignType() {
        if (signType == null) {
            return 2;
        }

        return signType;
    }
}
